#region Using

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;

using Gizmox.WebGUI.Common;
using Gizmox.WebGUI.Forms;

#endregion

namespace TVC.Modules.CustomControl
{
    public partial class ColTextGird : UserControl
    {
        public string FrmName = "Item Description";
        public bool FrmEnabled;
        public ColTextGird(Boolean Val,int Maxlength, String ToolTip)
        {
            InitializeComponent();
            FrmEnabled =  Val;
            textBox1.Enabled = FrmEnabled;
            textBox1.Multiline = true;
            ToolTip oTP1 = new ToolTip();
            oTP1.SetToolTip(this.btDesc, ToolTip);
            textBox1.MaxLength = Maxlength;
        }


        public object Value
        {
            get
            {
                return textBox1.Text;
            }
            set
            {
                textBox1.Text = string.Format("{0}", value);
                // cb.SelectedValue = string.Format("{0}", value);
            }
        }

        public override bool Focused
        {
            get
            {
                return textBox1.Focused;
            }
        }
        public bool IsFocus { get { return textBox1.Focused || btDesc.Focused; } }        
        private void btDesc_Click(object sender, EventArgs e)
        {
            Forms.frmPopupText frm = new Forms.frmPopupText();
            frm.Value = textBox1.Text;
            frm.EnableBox = FrmEnabled;
            frm.Text = FrmName;
            frm.FormClosed += (form, args) =>
            {
                if (((Forms.frmPopupText)form).DialogResult == DialogResult.OK)
                {
                    textBox1.Text = frm.Value;
                }
                textBox1.Focus();
            };
            frm.ShowDialog();
        }
    }
}